import { Injectable, Logger } from '@nestjs/common';
import { CreateCanaleRuleDto } from './dto/create-canale_rule.dto';
import { UpdateCanaleRuleDto } from './dto/update-canale_rule.dto';
import { InjectRepository } from '@nestjs/typeorm';
import { CouponInfo } from '../../coupon/coupon_info/entities/coupon_info.entity';
import { Repository } from 'typeorm';
import { CancelRule } from './entities/canale_rule.entity';
import { SuccessResponse } from '../../../util/ResultResponse';

@Injectable()
export class CanaleRuleService {
  private readonly logger: Logger = new Logger('CanaleRuleService');

  constructor(
    @InjectRepository(CancelRule)
    private readonly cancelRuleRepository: Repository<CancelRule>,
  ) {}
  create(createCanaleRuleDto: CreateCanaleRuleDto){

  }

  async findAll() : Promise<SuccessResponse<CancelRule[]>>  {
    return await this.cancelRuleRepository.find().then(result => {
      return {
        code: 0,
        data: result,
        message: '成功',
      };
    })
  }

  findOne(id: number) {
    return `This action returns a #${id} canaleRule`;
  }

  update(id: number, updateCanaleRuleDto: UpdateCanaleRuleDto) {
    return `This action updates a #${id} canaleRule`;
  }

  remove(id: number) {
    return `This action removes a #${id} canaleRule`;
  }
}
